package WaiBao;

import java.util.Arrays;

public class WuMengKun {
    public static void main(String[] args) {
        String[] name = {"张大兵(班长)", "嘎子(副班长)", "小李(学习委员)", "小胖(纪律委员)", "小虎(体育委员)", "小狼", "小坤", "小小黑", "小白", "小红", "小子", "小芬",
                "瘦子", "倪萍", "程咬金", "李大虎", "张大彪", "帅帅", "赤赤", "羡羡", "嘟嘟", "滴滴", "毛蛋", "王一博", "黄子韬", "张艺兴", "鹿晗", "追光者",
                "王靖雯", "吴梦坤(学生)"};//最后一位考生本人: 吴梦坤(学生)
        int[] Age = {18, 19, 20, 21, 22, 21, 21, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 19};//考生年龄：19岁


        double[]  turkey1 = {94, 84, 93, 80, 81, 84, 77, 79, 89, 90, 90, 87, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 96};
        double[]  turkey2 = {77, 84, 65, 74, 86, 91, 71, 84, 94, 77, 90, 77, 86, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 96};
        double[]  turkey3 = {71, 98, 90, 91, 71, 69, 76, 77, 85, 60, 94, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 95};

        double mule;//代表每个学生的总分
        double ass;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            mule = (turkey1)[i] + turkey2[i] +turkey3[i];
//            ass = ( mule * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + mule);
//            System.out.println(name[i] + "的平均分为:" + ass);
//        }


        double pone = 0, grouse = 0;
        double[] teel = new double[30];
//        for (int i = 0; i < 30; i++) {
//            pone  = turkey1[i] +  turkey2[i] + turkey3[i];
//            grouse = (pone * 1.0) / 3;
//            teel[i] = grouse ;
//        }
//
//        for (int i = 0; i <teel.length - 1; i++) {
//            for (int j = 0; j < teel.length - i - 1; j++) {
//                if (teel[j] < teel[j + 1]) {
//                    double tep = teel[j];
//                    teel[j] =teel[j + 1];
//                    teel[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(teel[i]);
//        }



        double yak1 = 0, yak2 = 0, yak3 = 0;//计算每门课的平均分
        double boar1 = 0, boar2 = 0 ,boar3 = 0;//计算每门课标准差
        double hog1 = 0,hog2 = 0, hog3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < turkey1.length; i++) {
            sum2+=turkey1[i];
        }
        yak1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+ yak1);
        double Sum = 0;
        for (int i = 0; i < turkey2.length; i++) {
            Sum+=turkey2[i];
        }
        yak2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+yak2);
        double sum = 0;
        for (int i = 0; i <turkey3.length; i++) {
            sum+=turkey3[i];
        }
        yak3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+ yak3);


////
        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <turkey1.length; i++) {
            c1+= (turkey1[i] - yak1)*(turkey1[i] -  yak1);
        }
        boar1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+ boar1);

        for (int i = 0; i <turkey2.length; i++) {
            c2+= (turkey2[i] -  yak2)*(turkey2[i] - yak2);
        }
        boar2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+ boar2);

        for (int i = 0; i < turkey3.length; i++) {
            c3+= (turkey3[i] - yak3)*(turkey3[i] -  yak3);
        }
        boar3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+ boar3);
//////////
////////////
//        Arrays.sort(turkey1);
//        Arrays.sort(turkey2);
//        Arrays.sort(turkey3);
//        hog1 =( turkey1[14]+turkey1[15])*1.0/2;
//        hog2 =(turkey2[14]+turkey2[15])*1.0/2;
//        hog3 =( turkey3[14]+turkey3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+hog1);
//        System.out.println("微生物学的中位数为:"+hog2);
//        System.out.println("人体组织解剖学的中位数为:"+hog3);
////




    }
}
